<template>
  <div class="comment-item" @click="$emit('click')">
    <span class="text-name">{{ data.userName }}</span>
    <template v-if="data.toUserName">
      <span class="text-normal text-normal--space">回复</span>
      <span class="text-name">{{ data.toUserName }}</span>
    </template>
    <span class="text-name">：</span>
    <span class="text-normal">{{ data.comment }}</span>
  </div>
</template>

<script>
export default {
  props: {
    data: {
      type: Object,
      required: true
    }
  }
}
</script>

<style lang="less">
.comment-item {
  font-size: 28px;
  color: #333;
  line-height: 1.4;
  padding: 4px 10px 4px 16px;

  .text-normal--space {
    margin-left: 4px;
    margin-right: 4px;
  }

  &:active {
    background-color: rgba(0, 0, 0, .1);
  }

  .text-name {
    font-family: @font-medium;
    font-weight: bold;
    color: #5d6c97;
  }
}
</style>
